package com.cloudcc.cloudframe.model.param;

import com.cloudcc.cloudframe.util.StringUtils;

public class DynamicType implements Comparable<DynamicType> {

	public int page;
	public String tag="";
	public String title="";

	
	
	public DynamicType() {
		super();
	}

	public DynamicType(int page, String tag, String title) {
		super();
		this.page = page;
		this.tag = tag;
		this.title = title;
	}

	@Override
	public int compareTo(DynamicType another) {
		if (another.page == this.page) {
			return 0;
		}
		return another.page < page ? 1 : -1;
	}

	@Override
	public boolean equals(Object o) {

		if (!(o instanceof DynamicType)) {
			return super.equals(o);
		}
		DynamicType dto = (DynamicType) o;

		if (dto.page == this.page || StringUtils.equals(title, dto.title)
				|| StringUtils.equals(tag, dto.tag))
			return true;
		return false;

	}
}
